import { Routes } from '@angular/router';
import { SheQuComponent } from './shequ/shequ.component';
import { SheQuDetailComponent } from './shequ/detail/shequ-detail.component';
import { JiuGaiXiangMuComponent } from './jiugaixiangmu/jiugaixiangmu.component';
import { LouYuanComponent } from './louyuan/louyuan.component';
import { LouYuanDetailComponent } from './louyuan/louyuan-detail/louyuan-detail.component';
import { LoginComponent } from './login/login.component';

export const routes: Routes = [
    {
        path:"login",
        component:LoginComponent,
    },
    {
        path: "shequ",
        component: SheQuComponent,
    },
    {
        path: "shequ/edit/:id",
        component: SheQuDetailComponent,
        data: { httpMethod: 'PUT' },
    },
    {
        path: "shequ/create",
        component: SheQuDetailComponent,
        data: { httpMethod: "POST" } //创建和修改非常相似，因此共用同一个组建，组建通过data中的httpMethod判断是创建还是修改
    },
    {
        path: "louyuan",
        component: LouYuanComponent
    },
    {
        path: "louyuan/edit/:id",
        component: LouYuanDetailComponent,
        data: { httpMethod: 'PUT' }
    },
    {
        path: "louyuan/create",
        component: LouYuanDetailComponent,
        data: { httpMethod: 'POST' }
    },
    {
        path: "jiugaixiangmu",
        component: JiuGaiXiangMuComponent
    },
    { path: "**", redirectTo: "" }
];
